﻿CloudDisk.SessionMgr = (function(){
    var session = null;
	var setting = CloudDisk.Setting;
	var util = CloudDisk.Util;
	return {
	    login: function(usrName, pwd){
			$.ajax({
				type: "POST",
				url: 'login.php',
				data: $('form').serialize(),
				dataType: 'json'
			}).done(function(){
			
			}).fail(function(xhr, textStatus){
			    util.alert(textStatus);
			});	
		},
		
		logout: function(){},
		
		getFilesByCategoryId: function(catId, callback){
		
		},
		
		addFolder: function(data, callback){
		    //$.ajax
			callback();
		},
		
		download: function(fileId){
		    window.open(setting.DOWNLOAD_URL + '?fileId=' + fileId, '_blank');
		},
		
		share: function(fileId, callback){
		    $.ajax({
				url: setting.SHARE_URL,
				data: {fileId: fileId}
			}).done(callback).fail(function(xhr, textStatus){
			    util.alert(textStatus);
			});
		},
		
		remove: function(fileId, callback){
		
		}
	};
})();